package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    /**
     * 根据菜品id查询是否关联套餐
     * @param dishIds
     * @return
     */
    List<Long> getSetmealIdsByDishId(List<Long> dishIds);

    /**
     * 将新增套餐关联菜品
     * @param setmealDishes
     */
    void insert(List<SetmealDish> setmealDishes);

    /**
     * 根据id查询套餐关联的菜品
     * @param setmealId
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id = #{setmealId}")
    List<SetmealDish> getSetmealId(Long setmealId);

    /**
     * 批量删除套餐关联的菜品
     * @param setmealIds
     */
    void deleteBatch(List<Long> setmealIds);

    @Delete("delete from setmeal_dish where id = #{id}")
    void deleteDishBySetmealID(Long id);
}
